package com.example.leetcode.linkedlist;

import com.example.leetcode.linkedlist.common.LinkedListUtils;
import com.example.leetcode.linkedlist.common.ListNode;

/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode() {}
 *     ListNode(int val) { this.val = val; }
 *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }
 */
class Solution21 {
    public ListNode mergeTwoLists(ListNode list1, ListNode list2) {
        return LinkedListUtils.mergeTwoLists(list1, list2);
    }
}
public class leetcode21 {
    public static void main(String[] args) {
        Solution21 solution21 = new Solution21();
        int[] nums1 = {1,2,4};
        int[] nums2 = {1,3,4};
        ListNode list1 = LinkedListUtils.generateLinkedListByArray(nums1);
        ListNode list2 = LinkedListUtils.generateLinkedListByArray(nums2);
        ListNode head = solution21.mergeTwoLists(list1, list2);
        System.out.println(LinkedListUtils.getLinkedListVals(head));
    }

}
